package main

import (
	. "fmt"
)

func main() {
	intChan := make(chan int, 10)
	for i:=1;i<=10;i++{
		intChan <- i
	}
	strChan := make(chan string, 5)
	for i:=1;i<=5;i++{
		strChan <- "go string" + Sprintf("%d", i)
	}

	for {
		select {
		case v:= <- intChan:
			Println("intChan读数据", v, "\n")
		case v:= <- strChan:
			Println("strChan读数据", v, "\n")
		default:
			//使用select不需要关闭channel
			//close(intChan)
			//close(strChan)
			return
		}
	}
}
